/**
 * jims
 */
package com.jims.master.modules.med.service;

import com.jims.master.common.persistence.Page;
import com.jims.master.common.service.CrudService;
import com.jims.master.modules.med.dao.MedicalVsPatientDao;
import com.jims.master.modules.med.entity.MedicalVsPatient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 医保卡与his人员关联Service
 * @author 陈晓阳
 * @version 2017-06-09
 */
@Service
@Transactional(readOnly = true)
public class MedicalVsPatientService extends CrudService<MedicalVsPatientDao, MedicalVsPatient> {


    @Autowired
    private MedicalVsPatientDao medicalVsPatientDao;

	public MedicalVsPatient get(String id) {
		return super.get(id);
	}
	
	public List<MedicalVsPatient> findList(MedicalVsPatient medicalVsPatient) {
		return super.findList(medicalVsPatient);
	}
	
	public Page<MedicalVsPatient> findPage(Page<MedicalVsPatient> page, MedicalVsPatient medicalVsPatient) {
		return super.findPage(page, medicalVsPatient);
	}
	
	@Transactional(readOnly = false)
	public int save(MedicalVsPatient medicalVsPatient) {
		return super.save(medicalVsPatient);
	}
	
	@Transactional(readOnly = false)
	public int delete(MedicalVsPatient medicalVsPatient) {
		return super.delete(medicalVsPatient);
	}

    /**
     * 根据门诊号查询医保信息
     * @param medicalVsPatient
     * @return
     */
    public boolean findByClinicNo(MedicalVsPatient medicalVsPatient) {
        boolean returnVal=true;
        String isLocal=medicalVsPatientDao.findByClinicNo(medicalVsPatient.getClinicNo());
        if("2".equals(isLocal)||"3".equals(isLocal) ){
            returnVal=false;
        }
        return returnVal;
    }
}